﻿Public Class frmGridResult

    Private Sub frmGridResult_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
    ''' <summary>
    ''' 设置网格
    ''' </summary>
    ''' <param name="Grid"></param>
    ''' <param name="nRows">格点数</param>
    ''' <param name="Ymin"></param>
    ''' <param name="Ymax"></param>
    ''' <param name="nCols">格点数</param>
    ''' <param name="Xmin"></param>
    ''' <param name="Xmax"></param>
    ''' <param name="nFormatNumber"></param>
    ''' <remarks></remarks>
    Public Sub SetGrid(ByVal Grid(,) As Double, ByVal nRows As Double, ByVal Ymin As Double, ByVal Ymax As Double _
                          , ByVal nCols As Double, ByVal Xmin As Double, ByVal Xmax As Double, ByVal nFormatNumber As Integer)
        Me.EFlex1.Rows.Count = 1
        Me.EFlex1.Cols.Count = 1
        If nRows > 0 And nCols > 0 Then
            Me.EFlex1.Rows.Count = nRows + 1
            Me.EFlex1.Cols.Count = nCols + 1
            Me.EFlex1.SetData(0, 0, "Y\X")
            For i As Integer = 0 To nRows - 1
                For j As Integer = 0 To nCols - 1
                    EFlex1.SetData(i + 1, j + 1, FormatNumber(Grid(i, j), nFormatNumber))
                Next
            Next
            For j As Integer = 0 To nRows - 1
                EFlex1.SetData(j + 1, 0, Ymax - j * (Ymax - Ymin) / (nRows - 1))
            Next
            For i As Integer = 0 To nCols - 1
                EFlex1.SetData(0, i + 1, Xmin+i * (Xmax - Xmin) / (nCols - 1))
            Next
        End If
        Me.EFlex1.AutoSizeCols()

    End Sub
End Class